
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace WebApplication1.DDD.Models.Entity.Common
{
    public struct users:NFinal.IModel
    {
		public System.Int64 id;
		public System.String name;
		public System.String pwd;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator users(string __value__)
        {
            var __value2__ = new users();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(users __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(users __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out users par)
		{
			par=new users();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.name=get["name"];
						par.pwd=get["pwd"];
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"name\":");
					tw.Write("\"");
					tw.Write(name==null?"null":name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"pwd\":");
					tw.Write("\"");
					tw.Write(pwd==null?"null":pwd);
					tw.Write("\"");

			tw.Write("}");
		}
		#endregion
    }
}
